{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "initial observation: [-0.4939685  0.       ]\n",
      "possible actions: 3\n",
      "\n",
      "taking action: 1\n",
      "got reward: -1.0. New state/observation is: [-4.94190433e-01 -2.21934537e-04]\n",
      "\n",
      "taking action: 2\n",
      "got reward: -1.0. New state/observation is: [-0.49363264  0.00055779]\n",
      "\n",
      "taking action: 1\n",
      "got reward: -1.0. New state/observation is: [-4.93299298e-01  3.33345525e-04]\n",
      "\n",
      "taking action: 1\n",
      "got reward: -1.0. New state/observation is: [-4.93192886e-01  1.06412255e-04]\n",
      "\n",
      "taking action: 1\n",
      "got reward: -1.0. New state/observation is: [-4.93314202e-01 -1.21315801e-04]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAvOklEQVR4nO3dd3xUVfrH8c+TTlUIEWMAqYqA1IjwQ5G1LEUE6QFCUZSOIESaggq6QCKyS0koygJBCCUgKMVFUFQQ2Ii0IG2F1ZDQkVACJJPz+yMTNkCEkGRyZ5Ln/XrNa2bO3Dv3ORC+3Jx77r1ijEEppZTrcLO6AKWUUvdGg1sppVyMBrdSSrkYDW6llHIxGtxKKeViNLiVUsrFOCy4RaSZiBwUkSMiMtJR21FKqYJGHDGPW0TcgUPAC0Ac8G+gszFmf65vTCmlChhH7XHXB44YY341xlwHooDWDtqWUkoVKB4O+t4A4PcM7+OAJ/9s4VKlSpny5cs7qBSllHI9x44d48yZM5LZZ44K7sw2dtOYjIj0BnoDlCtXjpiYGAeVopRSricwMPBPP3PUUEkcUDbD+zJAfMYFjDGzjTGBxphAPz8/B5WhlFL5j6OC+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Nw2P5cMsPyb9v7ehBobnX9d+jXU6T9erkH2GV/tHD1vgE1gZ/t/doHjLW3u3S/buljE/43q8Tl+0XarLPd9kdsek7kh75l96FnTiqllIuxeqhEKaXUPdLgVkopF6PBrZRSLkaDWymlXIwGt1JKuRgNbqWUcjEa3Eop5WI0uJVSysX8P+qOw6eHJeelAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import gym\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "env = gym.make('MountainCar-v0')\n",
    "# reset environment and get initial observation/state\n",
    "# Observation/state is a tuple of (position, velocity)\n",
    "obs = env.reset()\n",
    "print(\"initial observation:\", obs)\n",
    "\n",
    "# possible 3 actions\n",
    "# {0: \"accelerate to left\", \"1\": \"do nothing\", \"2\": \"accelerate to right\"}\n",
    "print(\"possible actions:\", env.action_space.n)\n",
    "\n",
    "\n",
    "# reinforcement learning is all\n",
    "# about learing to take good actions\n",
    "# from a given state/observation\n",
    "# right now taking a random action\n",
    "def policy(observation):\n",
    "    return env.action_space.sample()\n",
    "\n",
    "\n",
    "# take 5 random actions/steps\n",
    "for _ in range(5):\n",
    "\n",
    "    # to render environment for visual inspection\n",
    "    # when you train, you can skip rendering to speed up\n",
    "    plt.imshow(env.render(mode='rgb_array'))\n",
    "\n",
    "    # based on curret policy, use the current observation\n",
    "    # to find the best action to take.\n",
    "    action = policy(obs)\n",
    "    print(\"\\ntaking action:\", action)\n",
    "\n",
    "    # pass the action to env which will return back\n",
    "    # with new state/\"observation\" and \"reward\"\n",
    "    # there is a \"done\" flag which is true when game ends\n",
    "    # \"info\" provides some diagnostic information\n",
    "    obs, reward, done, info = env.step(action)\n",
    "    print(\"got reward: {0}. New state/observation is: {1}\".format(reward, obs))\n",
    "\n",
    "# close the enviroment\n",
    "env.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "initial observation: [ 0.00865361 -0.02060278 -0.0131732  -0.01191525]\n",
      "possible actions: 2\n",
      "\n",
      "taking action: 0\n",
      "got reward: 1.0. New state/observation is: [ 0.00824156 -0.21553336 -0.0134115   0.27658244]\n",
      "\n",
      "taking action: 0\n",
      "got reward: 1.0. New state/observation is: [ 0.00393089 -0.41046143 -0.00787985  0.56500538]\n",
      "\n",
      "taking action: 1\n",
      "got reward: 1.0. New state/observation is: [-0.00427834 -0.21522981  0.00342025  0.2698504 ]\n",
      "\n",
      "taking action: 0\n",
      "got reward: 1.0. New state/observation is: [-0.00858293 -0.4104004   0.00881726  0.56361013]\n",
      "\n",
      "taking action: 0\n",
      "got reward: 1.0. New state/observation is: [-0.01679094 -0.60564496  0.02008946  0.85905782]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAASeElEQVR4nO3db4xdd33n8fcHxzFeEopTT7LGfzYu6642QRunO3JYZbXKAm28KarhAZWRivwgkvMgSKCtWJJW2oJWlsqqwD5ZWIUlwmIpxhIkcSltcb0ghBriOOAEO44Tl7h4sLEnDmwCaUzsfPfBHCsXZ8ZzPX9685v7fklX95zv+Z17v79o/PHJz+fOTVUhSWrH6wbdgCTp0hjcktQYg1uSGmNwS1JjDG5JaozBLUmNmbfgTrIxyeEkR5LcNV/vI0nDJvNxH3eSRcCTwG8DY8DDwPuq6vE5fzNJGjLzdcW9AThSVT+sql8CO4BN8/RekjRULpun110JHOvZHwNummrw8uXL69prr52nViSpPUePHuWZZ57JZMfmK7gne7NfWZNJshXYCrBmzRr27ds3T61IUntGR0enPDZfSyVjwOqe/VXA8d4BVXV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sRFxrY2t0s26CvuMWB1z/4q4PiAeplLJ5OsAOieT3X1puabZDETof3FqvpqV14QcwOoqp8B3wI20v68bgZ+L8lRJpYc357k/9D+vACoquPd8yngPiaWPhbE3GZi0MH9MLAuydoklwObgV0D7mku7AK2dNtbgAd66puTLEmyFlgH7B1Af9PKxKX154BDVfXJnkNNzy3JSHelTZKlwDuBJ2h8XlV1d1Wtqqprmfhz9H+r6g9ofF4ASd6Q5Mrz28DvAAdYAHObsUH/6yhwGxN3LPw98MeD7mcG/X8JOAG8xMTf9LcDvw7sAZ7qnq/qGf/H3VwPA/9p0P1fZF7/non/vXwM2N89bmt9bsC/Ab7fzesA8F+7etPzumCOt/DKXSXNz4uJu84e7R4Hz+fEQpjbTB9+clKSGjPopRJJ0iUyuCWpMQa3JDXG4JakxhjcktQYg1uSGmNwS1JjDG5Jasz/B8p9csiOXenNAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "env = gym.make('CartPole-v1')\n",
    "obs = env.reset()\n",
    "print(\"initial observation:\", obs)\n",
    "print(\"possible actions:\", env.action_space.n)\n",
    "\n",
    "\n",
    "def policy(observation):\n",
    "    return env.action_space.sample()\n",
    "\n",
    "\n",
    "for _ in range(5):\n",
    "    plt.imshow(env.render(mode='rgb_array'))\n",
    "\n",
    "    action = policy(obs)\n",
    "    print(\"\\ntaking action:\", action)\n",
    "\n",
    "    obs, reward, done, info = env.step(action)\n",
    "    print(\"got reward: {0}. New state/observation is: {1}\".format(reward, obs))\n",
    "\n",
    "\n",
    "# close the enviroment\n",
    "env.close()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
